package mta.io.csv.writer;

import mta.util.FilesystemUtil;

import java.util.HashMap;

/**
 * Created by Dmitry Nikolaev.
 * User: dima
 * Date: 22.01.2009
 * Time: 19:06:26
 */
public class CsvTranslationsWriter {
    private String path;
    private CsvTranslationWriterFactory writerFactory;

    public CsvTranslationsWriter(String path, CsvTranslationWriterFactory writerFactory) {
        this.path = path;
        this.writerFactory = writerFactory;
    }

    public void writeFile(String filename, HashMap<String, String> phrases) {
        CsvTranslationWriter writer = writerFactory.buildWriter(path + filename);
        writer.writePhrases(phrases);
    }

    public void clear() {
        FilesystemUtil.cleanDirectoryFromCsv(path);
    }
}
